#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
//在前面填充字符
int main(){

    int n;
    cin>>n;
    string t,a;
    cin>>t;
    getchar();
    getline(cin,a);
    int len =a.length();
    // cout<<t<<"\n"<<a<<len;
    if(n<len){
        cout<<a.substr(len-n,len)<<"\n";
    }else if(n==len){
        cout<<a<<"\n";
    }else{
        //待填充的个数 
        int count=n-len;
        for(int i=1;i<=count;i++)
            cout<<t;
        cout<<a<<"\n";
    }
    return 0;
}